<div class="fyl-p20" xmlns:th="http://www.thymeleaf.org">
    <div class="fyl-mb10">
        <form id="childToolbar">
            <input type="hidden" th:value="${noDataIds}" name="noDataIds">
            <div class="row">
                <div class="col-md-4 fyl-mb10">
                    <input type="text" class="form-control fyl-child-clear" name="name"
                           placeholder="姓名">
                </div>
                <div class="col-md-4 fyl-mb10">
                    <a href="javascript:void(0)" class="btn btn-primary" id="childSearchBtn">查询</a>
                    <a href="javascript:void(0)" class="btn btn-warning" id="childClearSearchBtn">清空</a>
                </div>
            </div>
        </form>
    </div>
    <table id="childTable" data-url="/admin/select/ajax/user"></table>
</div>
<script>
    var $childTable = $("#childTable");
    var $childSearch = $("#childSearchBtn");
    var childSelections = [];
    var childColumns = [{
        checkbox: true
    }, {
        field: 'loginName',
        title: '用户账号',
    }, {
        field: 'name',
        title: '用户姓名',
    }, {
        field: 'gender',
        title: '用户性别',
        formatter: genderChildFormatter
    }/*, {
        field: 'type',
        title: '用户类型',
        formatter: typeChildFormatter
    }*/]

    function genderChildFormatter(value, row, index) {
        if (row.gender === "B") {
            return "男";
        } else if (row.gender === "C") {
            return "女";
        } else {
            return "其他";
        }
    }

    function typeChildFormatter(value, row, index) {
        if (row.type === "A") {
            return "管理员";
        } else {
            return "普通用户";
        }
    }

    $(function () {
        tableListChild($childTable, childColumns, function () {
            // $remove.prop('disabled', !$childTable.bootstrapTable('getSelections').length)

            // save your data, here just save the current page
            childSelections = getIdChildSelections()
            // push or splice the selections if you want to save all data selections
        })
    })

    function getIdChildSelections() {
        return $.map($childTable.bootstrapTable('getSelections'), function (row) {
            return row.id
        })
    }

    $childSearch.click(function () {
        $childTable.bootstrapTable('refresh');
    })

</script>